<template>
  <div style="width: 100%;height: 100%" class="fx">
    <h1>401</h1>

  </div>

</template>

<script lang="ts">
import {refreshMenu, refreshUserInfo, systemLogin} from "@/common/api/common";
import {pushAddParam} from "@/common/router/router";

export default {
  mounted() {
    //全局监听-刷新当前页面
    this.$event.$on('refresh', (data) => {
      if (this.$route.path == data['path']) {
        this.resetForm('defSearch');
        this.queryPage()
      }
    })
  },
  data() {
    return {
      show: {
        loading: false,
        verify: false,
      },
      //默认表单
      defForm: {
        data: {
          account: '',
          password: '',
          code: '',
          type: '0',
        },
      },
    };
  },
  methods: {
    login() {
      if (!this.defForm.data.account) {
        this.$message.warning("请输入账号")
        return;
      }
      if (!this.defForm.data.password) {
        this.$message.warning("请输入密码")
        return;
      }

      //登录
      systemLogin(this.defForm.data.account, this.defForm.data.password)
          .then(async (loginStatus) => {
            if (loginStatus) {
              //刷新查用户信息
              await refreshUserInfo()

              //刷新菜单信息
              await refreshMenu();

              let query = this.$route.query;
              if (query && query.redirect) {
                pushAddParam(query.redirect)
              } else {
                pushAddParam("/")
              }
              //console.log("【loginStatus】", loginStatus)
            }
          })
    },
  }
}
</script>

<style scoped lang="less">

</style>
